﻿# coding: utf-8
import wx

import ParticleEmitter

class wxDialogCreateParticleModifier(wx.Dialog):
    MODIFIER_DESC_DICT = {
         TD.COLOR_MODIFIER : ParticleEmitter.PMT_COLOR,
         TD.SIZE_MODIFIER : ParticleEmitter.PMT_SIZE,
         TD.DIRECTION_FORCE_MODIFIER : ParticleEmitter.PMT_DIRECTION_FORCE,
         TD.TEXTURE_FRAME_MODIFIER : ParticleEmitter.PMT_TEXTURE_FRAME,
    }
    
    def __init__(self, parent):
        wx.Dialog.__init__(self, parent, title = TD.ADD_PARTICLE_MODIFIER)
        
        static = wx.StaticText(self, wx.NewId(), TD.MODIFIER_TYPE)
        self._cbType = wx.ComboBox(self, wx.NewId(), style =  wx.CB_DROPDOWN|wx.CB_READONLY)
        for i in wxDialogCreateParticleModifier.MODIFIER_DESC_DICT.keys():
            self._cbType.Append(i)
            
        self._cbType.SetSelection(0)
            
        bnOk = wx.Button(self, wx.ID_OK, TD.BUTTON_OK)
        bnCancel = wx.Button(self, wx.ID_CANCEL, TD.BUTTON_CANCEL)
        
        sizerModifierType = wx.BoxSizer(wx.HORIZONTAL)
        sizerModifierType.Add(static, 0, wx.CENTER, border = 10)
        sizerModifierType.Add(self._cbType, 1, wx.ALL|wx.EXPAND, border = 5)
        
        sizerOkCancel = wx.BoxSizer(wx.HORIZONTAL)
        sizerOkCancel.Add(bnOk, 0, wx.ALL, border = 15)
        sizerOkCancel.Add(bnCancel, 0, wx.ALL, border = 15)
                
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(sizerModifierType, 0, wx.LEFT|wx.RIGHT|wx.TOP|wx.EXPAND, border = 10)
        sizer.Add(sizerOkCancel, 0, wx.CENTER, border = 15)
        self.SetSizer(sizer)
        self.Fit()        

    def GetModifierType(self):
        return wxDialogCreateParticleModifier.MODIFIER_DESC_DICT[self._cbType.GetValue()]
